// 连接数据库
const mongoose = require('./db');
// 婚纱类别表
const hunshaTypeSchema = new mongoose.Schema({
    name:String,
    // type:String,
    _p:Number,
    typeid:{
        type:mongoose.Schema.Types.ObjectId,
        ref:'hunshaType'
    }
})
let hunshaTypeModel = mongoose.model('hunshaType', hunshaTypeSchema,'hunshaType');


// 婚纱表
const hunshaSchema = new mongoose.Schema({
    name:String, // 婚纱名称
    price:Number, // 价格
    img:String, // 图片
    imgid:{
        type:[mongoose.Schema.Types.ObjectId],
        ref:'img'
    },
    desc:String, // 描述
    type:Array, // 类型
})
let hunshaModel = mongoose.model('hunsha', hunshaSchema,'hunsha');

// 婚纱照片表
const imgSchema = new mongoose.Schema({
    url:String
})
let imgModel = mongoose.model('img', imgSchema,'img');

//耿浩志
//首页婚纱表(仅首页展示)
const WeddingDressSchema=new mongoose.Schema({
    img:String,
})
let WeddingDressModel=mongoose.model('weddingdress',WeddingDressSchema,'weddingdress');

//在首页点击获取该套婚纱照
const WeddingDressSearchSchema=new mongoose.Schema({
    img:String,
    kind:String,
})
let WeddingDressSearchModel=mongoose.model('weddingdresssearch',WeddingDressSearchSchema,'weddingdresssearch');

module.exports = {hunshaTypeModel,hunshaModel,imgModel,WeddingDressModel,WeddingDressSearchModel};